﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using FTLiteLogic.Helper;

namespace FullThrustLogic.Helper
{
    public class DiceHelper
    {
        private static int _minDiceNumber = 1;
        private static int _maxDiceNumber = 6;

        public static int RollDice()
        {
            Random random = new Random(RandomProvider.Next() ^ Environment.TickCount);
          
            return random.Next(_minDiceNumber, _maxDiceNumber);
        }

        public static bool DetermineSuccess(int targetNumber, int numberOfDice)
        {
            bool success = false;

            for (int i = 0; i < numberOfDice; i++ )
            {
                success = (targetNumber >= RollDice());

                if (success)
                {
                    return success;
                }
            }

            return success;
        }

    }
}
